<template>
  <div class="facility">
    <DetailSection title-text="房屋设施" footer-text="查看全部设施">
      <div class="facility-inner">
        <template
          v-for="(item, index) of facilityData.houseFacilitys"
          :key="index"
        >
          <!-- 匹配允许显示的下标 -->
          <div class="tag" v-if="facilityData.facilitySort.includes(index)">
            <div class="head">
              <div class="head-item">
                <img class="icon" :src="item.icon" alt="" />
                <div class="head-text">{{ item.groupName }}</div>
              </div>
            </div>
            <div class="list">
              <template v-for="(i, x) of item.facilitys.slice(0, 4)" :key="x">
                <div class="item">
                  <span class="item-img"></span>
                  {{ i.name }}
                </div>
              </template>
            </div>
          </div>
        </template>
      </div>
    </DetailSection>
  </div>
</template>

<script setup>
import detailSection from "../../../components/detail-section/detail-section.vue";

defineProps({
  facilityData: {
    type: Object,
    default: () => ({}),
  },
});
</script>

<style lang="less" scoped>
.facility-inner {
  background-color: #f7f9fb;
  padding: 21px 16px;
  -webkit-border-radius: 6px;
  border-radius: 6px;
  .tag {
    display: flex;
    margin-top: 10px;
    .head {
      display: flex;
      -webkit-box-align: center;
      -webkit-align-items: center;
      -ms-flex-align: center;
      align-items: center;
      -webkit-box-pack: start;
      -webkit-justify-content: flex-start;
      -ms-flex-pack: start;
      justify-content: flex-start;
      width: 90px;
      padding-top: 7px;
      margin-top: -6px;
      .head-item {
        display: flex;
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -webkit-flex-direction: column;
        -ms-flex-direction: column;
        flex-direction: column;
        -webkit-box-align: center;
        -webkit-align-items: center;
        -ms-flex-align: center;
        align-items: center;
        white-space: nowrap;
      }
      .icon {
        width: 20px;
        height: 20px;
      }
      .head-text {
        font-size: 11px;
        color: #333;
        font-weight: 600;
        margin-top: 3px;
      }
    }
    .list {
      display: flex;
      flex-wrap: wrap;
      width: 80%;
      .item {
        width: 50%;
        margin: 2px 0;
        .item-img {
          display: inline-block;
          background-color: var(--tjc-theme-assistant-green, #17d2bc);
          -webkit-mask: url(https://pic.tujia.com/upload/festatic/mp/check_green.png)
            no-repeat;
          mask: url(https://pic.tujia.com/upload/festatic/mp/check_green.png)
            no-repeat;
          mask-size: auto;
          -webkit-mask-size: 100% 100%;
          mask-size: 100% 100%;
          width: 12px;
          height: 12px;
        }
      }
    }
  }
}
</style>
